package com.example.novelstory.utill;

//统一controller的返回类型，将返回数据包装到此类的实例化中


import com.tencentcloudapi.vod.v20180717.models.StickerTrackItem;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author jieli
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
public class Result {
    /**controller返回的状态码，用于向用户和前端听从的操作信号*/
    private String statusCode;
    /**返回前端的后端信息相关*/
    private String msg;
    /**返回至前端的数据Object*/
    private Object data;
    /**成功时*/
    public static Result success(String statusCode, String msg){
        return new Result(statusCode, msg, null);
    }
    public static Result successMsg(String statusCode,String msg,Object data){
        return new Result(statusCode,msg,data);
    }
    /**错误时*/
    public static Result error(String statusCode,String msg){
        return new Result(statusCode, msg, null);
    }
    public static Result errorVerifyCode(){
        return new Result(Constants.CODE_500, "验证码错误", null);
    }
    public static Result errorTimeout(){
        return new Result(Constants.CODE_500, "短信过期", null);
    }
    public static Result errorSms(){
        return new Result(Constants.CODE_600, "发送短信失败", null);
    }
    /**系统错误时*/
    public static Result error(){
        return new Result(Constants.CODE_500, "系统错误", null);
    }
}
